package com.fh.controller.system.timer;

/**
 * Created by caozengling on 2018/2/1.
 */

import com.fh.service.building.RecordService;
import com.fh.util.DateUtil;
import com.fh.util.PageData;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
@DisallowConcurrentExecution
public class Deletelog implements Job {
    private RecordService recordService = (RecordService)ApplicationContextUtil.getBean("recordService");
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        this.deleteLog();
    }
    //定时删除日志记录
    private void deleteLog(){
        try {
            PageData pd = new PageData();
            String delDate=DateUtil.getAfterDayDate("-180");
            pd.put("DelDate",delDate);
            recordService.DeleteLog(pd);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        String delDate=DateUtil.getAfterDayDate("-180");
        System.out.println(delDate);
    }
}
